﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Kinect.Toolbox
{
    public class ToolboxEvents : IToolboxEvents, IToolboxEventsInvoker, IKinectEvents, IKinectEventsInvoker
    {
        public event EventHandler FrameProviderChanging;
        public event EventHandler FrameProviderChanged;

        public event EventHandler KinectInitializing;
        public event EventHandler KinectInitialized;
        public event EventHandler KinectUninitializing;
        public event EventHandler KinectUninitialized;

        public void OnKinectInitializing()
        {
            if (KinectInitializing != null)
            {
                KinectInitializing(this, EventArgs.Empty);
            }
        }

        public void OnKinectInitialized()
        {
            if (KinectInitialized != null)
            {
                KinectInitialized(this, EventArgs.Empty);
            }
        }

        public void OnKinectUninitializing()
        {
            if (KinectUninitializing != null)
            {
                KinectUninitializing(this, EventArgs.Empty);
            }
        }

        public void OnKinectUninitialized()
        {
            if (KinectUninitialized != null)
            {
                KinectUninitialized(this, EventArgs.Empty);
            }
        }
        public void OnFrameProviderChanging()
        {
            if (FrameProviderChanging != null)
            {
                FrameProviderChanging(this, EventArgs.Empty);
            }
        }

        public void OnFrameProviderChanged()
        {
            if (FrameProviderChanged != null)
            {
                FrameProviderChanged(this, EventArgs.Empty);
            }
        }
    }

    public interface IToolboxEventsInvoker
    {
        void OnFrameProviderChanging();
        void OnFrameProviderChanged();
    }

    public interface IToolboxEvents
    {
        event EventHandler FrameProviderChanging;
        event EventHandler FrameProviderChanged;
    }

    public interface IKinectEvents
    {
        event EventHandler KinectInitializing;
        event EventHandler KinectInitialized;
        event EventHandler KinectUninitializing;
        event EventHandler KinectUninitialized;
    }

    internal interface IKinectEventsInvoker
    {
        void OnKinectInitializing();
        void OnKinectInitialized();
        void OnKinectUninitializing();
        void OnKinectUninitialized();
    }
}
